#include <Arduino.h>

#include "lvgl/lvgl.h"
// #include "do_mian.h"
// uncomment a library for display driver
// #define USE_TFT_ESPI_LIBRARY
#define USE_ARDUINO_GFX_LIBRARY

#include "lv_xiao_round_screen.h"

// LVGL
#define LV_TICK_PERIOD_MS 10
#define LV_HOR_RES_MAX 240
#define LV_VER_RES_MAX 240
// I2S.setAllPins(-1, 42, 41, -1, -1);

LV_IMG_DECLARE(fighters);
LV_IMG_DECLARE(wukongs);
LV_IMG_DECLARE(wukongn);


/* Creates a semaphore to handle concurrent call to lvgl stuff
 * If you wish to call *any* lvgl function from other threads/tasks
 * you should lock on the very same semaphore! */
SemaphoreHandle_t xGuiSemaphore;

void setup()
{
    Serial.begin(115200); // prepare for possible serial debug
    Serial.println("XIAO round screen - LVGL_Arduino");

    lv_init();

    lv_xiao_disp_init();
    lv_xiao_touch_init();
    // lv_demo_music();
// lv_demo_widgets();
// ui_mian(); //
    //     lv_example_scroll_6();
    lv_obj_t * gif = lv_gif_create(lv_scr_act());
    lv_gif_set_src(gif,&fighters);
    lv_obj_center(gif);
    // lv_obj_t *label = lv_label_create(gif);
    // lv_label_set_text(label,"Hello world");
    // lv_obj_center(label);
}

void loop()
{
    lv_timer_handler(); // let the GUI do its work
    delay(10);

}


